package com.pyue.eam.admin.config;

import org.dromara.email.api.MailClient;
import org.dromara.email.comm.config.MailSmtpConfig;
import org.dromara.email.core.factory.MailFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SMSMailConfig {
   /*  @Bean("qqMailClient")
    public MailClient qqMailClient() {
        // 以下仅做演示，实际使用需要填入数据
        MailSmtpConfig config = MailSmtpConfig.builder().build();
        // 这里的key可以是任何可对比类型，用于后续从工厂取出邮件实现类用
        MailFactory.put("qq", config);
        return MailFactory.createMailClient("qq");
    } */


    @Bean("wyMailClient")
    public MailClient wyMailClient() {
        // 以下仅做演示，实际使用需要填入数据
        MailSmtpConfig config = MailSmtpConfig.builder()
                .port("465")
                .fromAddress("guodaxia5732@163.com")
                .smtpServer("smtp.163.com")
                .username("guodaxia5732@163.com")
                .password("guoru5732jiliang")
                .retryInterval(10)
                .maxRetries(3)
                .build();
        // 这里的key可以是任何可对比类型，用于后续从工厂取出邮件实现类用
        MailFactory.put("wy", config);
        return MailFactory.createMailClient("wy");
    }
}
